package ynu.lcy.elememicroserviceuserauthservice9091.chain;


import ynu.lcy.elememicroservicecommon.exception.BusinessException;
import ynu.lcy.elememicroservicecommon.utils.ErrorCode;

/**
 * 检查账号密码是否为空
 * */
public class EmptyCheckHandler extends AbstractAuthenticationHandler {
    @Override
    public void handle(AuthenticationContext context) throws BusinessException {
        if (context.getPhoneNumber() == null || context.getPhoneNumber().isEmpty() ||
                context.getPassword() == null || context.getPassword().isEmpty()) {
            throw new BusinessException(ErrorCode.Authentication_ERROR,"手机号或密码不能为空");
        }
        handleNext(context);
    }
}
